Recording apparatus, control method, and storage medium

ABSTRACT

A recording apparatus is provided. An adjustment unit executes adjustment processing for adjusting a delay amount of a timing signal. An input control unit executes input control to input continuously recording target data to be recorded to a storage medium, to a buffer memory. A recording control unit executes recording control for recording the recording target data held in the buffer memory to the storage medium, using an input/output unit configured to receive data from the storage medium according to the timing signal. A control unit performs control such that the input control is started before a recording start instruction and the recording control is started in response to the recording start instruction, and such that the adjustment processing is executed during execution of the input control and before the recording control is started in response to the recording start instruction.

BACKGROUND OF THE INVENTION Field of the Invention

The present invention relates to a recording apparatus, a controlmethod, and a storage medium.

Description of the Related Art

Conventionally, there are apparatuses for writing image data, audio dataand the like to a storage medium such as a memory card and the like, andreading out and reproduce data recorded in the storage medium.Reading/writing of data between an apparatus (host apparatus) to whichthe storage medium is connected and the storage medium is performed inaccordance with clock signals generated in the host apparatus. Afterhost apparatus transmits a clock pulse of a clock signal,transmission/reception of the data to be written or read-out, orreception of a response corresponding to a command is performed. Forthis reason, the clock pulse is not transmitted/received at a timingcompletely synchronized with the transmission/reception of the data andthe response. For example, when the host apparatus performs reading-outof the data from a storage medium such as an SD memory card, a delay ofa standardized fixed value exists after the clock pulse is given fromthe host apparatus to the storage medium and until data transmission isperformed. For this reason, the host apparatus acquires the datatransmitted from the storage medium by latching the data transmittedfrom the storage medium at a timing delayed by the fixed value aftertransmission of the clock pulse.

On the other hand, in recent years, due to improvement of data rate forreading/writing to such a storage medium, acceleration of the clockpulse frequency has been necessary, which has made it difficult for thedelay amount from the clock pulse for acquiring the data to be definedby a fixed value. In view of this, UHS-I (Ultra High Speed I), a highspeed standard of SD cards, defines that reading-out of data should beperformed after adjusting a data latch timing for each card whenperforming reading-out of data using a high-speed clock. Such adjustmentwork for latch timing is called tuning (e.g. see Japanese PatentLaid-Open No. 2012-54715).

Also, in recent years, image capturing apparatuses have been proposedthat have a function of storing captured moving images in a buffermemory in a recording standby state, and when a recording startinstruction is given, recording the moving image data that is stored inthe buffer memory and corresponds to a certain period just before thestart of recording, to a storage medium. This function is called“pre-recording”.

When pre-recording is performed, since moving image data is repeatedlyinput to the buffer memory in the recording standby state, availablecapacity in the buffer memory decreases. Then, when a recording startinstruction is given, recording to the storage medium is performed at aspeed higher than that of inputting moving image data to the buffermemory, and thus the available capacity in the buffer memory graduallyincreases. However, if a write error or a retry occurs due to lack oftuning at a timing just after the start of recording, the moving imagedata cannot be written to the storage medium, and there is a possibilitythat the buffer memory will overflow.

SUMMARY OF THE INVENTION

The present invention has been made in view of the above circumstancesand provides a technique for reducing the likelihood that a bufferoverflow will occur after the start of recording in a case whereinputting of recording target data to the buffer memory starts before arecording start instruction is given.

According to a first aspect of the present invention, there is provideda recording apparatus comprising: an output unit configured to output aclock signal to a storage medium; an input/output unit configured tooutput a write command and data to be written to the storage mediumaccording to the clock signal in order to write data to the storagemedium, and configured to receive data from the storage medium accordingto a timing signal; a generation unit configured to generate the timingsignal by delaying the clock signal; an adjustment unit configured toexecute adjustment processing for adjusting a delay amount of the timingsignal; a buffer memory configured to hold input data; an input controlunit configured to execute input control to input continuously recordingtarget data to be recorded to the storage medium, to the buffer memory;a recording control unit configured to execute recording control forrecording the recording target data held in the buffer memory to thestorage medium, using the input/output unit; and a control unitconfigured to control the input control unit, the recording controlunit, and the adjustment unit, wherein the control unit: performscontrol such that the input control is started before a recording startinstruction and the recording control is started in response to therecording start instruction; and performs control such that theadjustment processing is executed during execution of the input controland before the recording control is started in response to the recordingstart instruction.

According to a second aspect of the present invention, there is provideda control method executed by a recording apparatus comprising: an outputunit configured to output a clock signal to a storage medium; aninput/output unit configured to output a write command and data to bewritten to the storage medium according to the clock signal in order towrite data to the storage medium, and configured to receive data fromthe storage medium according to a timing signal; a generation unitconfigured to generate the timing signal by delaying the clock signal;and a buffer memory configured to hold input data, the control methodcomprising: executing adjustment processing for adjusting a delay amountof the timing signal; executing input control to input continuouslyrecording target data to be recorded to the storage medium, to thebuffer memory; executing recording control for recording the recordingtarget data held in the buffer memory to the storage medium, using theinput/output unit; performing control such that the input control isstarted before a recording start instruction and the recording controlis started in response to the recording start instruction; andperforming control such that the adjustment processing is executedduring execution of the input control and before the recording controlis started in response to the recording start instruction.

According to a third aspect of the present invention, there is provideda non-transitory computer-readable storage medium which stores a programfor causing a computer of a recording apparatus to execute a controlmethod, the recording apparatus comprising: an output unit configured tooutput a clock signal to a storage medium; an input/output unitconfigured to output a write command and data to be written to thestorage medium according to the clock signal in order to write data tothe storage medium, and configured to receive data from the storagemedium according to a timing signal; a generation unit configured togenerate the timing signal by delaying the clock signal; and a buffermemory configured to hold input data, the control method comprising:executing adjustment processing for adjusting a delay amount of thetiming signal; executing input control to input continuously recordingtarget data to be recorded to the storage medium, to the buffer memory;executing recording control for recording the recording target data heldin the buffer memory to the storage medium, using the input/output unit;performing control such that the input control is started before arecording start instruction and the recording control is started inresponse to the recording start instruction; and performing control suchthat the adjustment processing is executed during execution of the inputcontrol and before the recording control is started in response to therecording start instruction.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments (with reference to theattached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a configuration example of a digitalcamera 100.

FIG. 2 is a block diagram showing detail of a memory card controller113.

FIG. 3 is a flowchart of processing for controlling execution of tuningwhile the digital camera 100 is pre-recording.

FIG. 4 is a diagram for describing a series of operations in theflowchart in FIG. 3.

FIG. 5 is a flowchart of processing for controlling execution of tuningwhile the digital camera 100 is recording the moving image data.

FIG. 6 is a diagram for describing a series of operations in theflowcharts in FIGS. 3 and 5.

DESCRIPTION OF THE EMBODIMENTS

Hereinafter, embodiments of the present invention will be described withreference to the attached drawings. It should be noted that thetechnical scope of the present invention is defined by the claims, andis not limited by the following respective embodiments. Also, not all ofthe combinations of the aspects that are described in the embodimentsare necessarily essential to the present invention. Also, the aspectsthat are described in the respective embodiments can be combined asappropriate.

First Embodiment

An embodiment will be described in which a recording apparatus of thepresent invention is applied to an image capturing apparatus such as adigital camera. FIG. 1 is a block diagram showing a configurationexample of a digital camera 100 according to a first embodiment. In FIG.1, a photographic lens 101 captures a subject image, and forms thesubject image on an image sensor 103 after a light amount is limited toa predetermined amount by a diaphragm 102. The formed subject image isdigitized by an A/D converter 104. After an image processing unit 105performs gamma compensation, white balance compensation, noisereduction, and the like, the digitized image data is output to a databus 107 as uncompressed image data.

A JPEG encoding unit 108 performs compression-encoding on theuncompressed image data to a still image, and generates JPEG still imagedata. An MPEG encoding unit 109 performs compression-encoding on theuncompressed image data to a moving image, and generates MPEG movingimage data.

A liquid crystal panel 111 is a display unit that displays images andvarious kinds of information. A liquid crystal driver 112 converts datafor image display stored in the DRAM 116 to liquid crystal displaysignals, and supplies the signals to the liquid crystal panel 111. Inthis way, the image data to be displayed that was written to the DRAM116 is displayed by the liquid crystal panel 111 via the liquid crystaldriver 112. The liquid crystal panel 111 can also function as anelectronic viewfinder and perform through-image display. When the liquidcrystal panel 111 is caused to function as the electronic viewfinder,the liquid crystal driver 112 reduces the resolution of digital signalsthat were once A/D converted by the A/D converter 104 and accumulated inthe DRAM 116, according to dot count of the liquid crystal panel 111.After that, the liquid crystal driver 112 converts the digital signalsto liquid crystal display signals, and sequentially transfers the liquiddisplay signals to the liquid crystal panel 111.

The DRAM 116 is used also as a buffer memory for temporarily storingdata to be recorded in a flash memory card 115, such as JPEG still imagedata generated in the JPEG encoding unit 108 or MPEG moving image datagenerated in the MPEG encoding unit 109. In addition, as describedlater, if pre-recording is activated, the encoded moving image data issequentially (continuously) input to and stored in the buffer memory inthe DRAM 116 in the recording standby state. The moving image datastored in the buffer memory is managed in units of GOPs of the MPEGmoving image data. If the data amount of moving image data stored in thebuffer memory in the recording standby state exceeds a threshold value,the moving image data is discarded in units of GOPs from the buffermemory. The data stored in the buffer memory space in the DRAM 116 isread out by the memory card controller 113 and written to the flashmemory card 115 (storage medium). Writing/reading of data to/from thebuffer memory space is controlled by the main microcomputer 118. Inaddition, the DRAM 116 also provides a working memory space for a pixelcount conversion unit 110 that generates thumbnail images to be used foran index display during reproduction, from the captured images.Furthermore, as described above, the DRAM 116 also provides a spaceserving as a video memory for performing display on the liquid crystalpanel 111.

The flash memory card 115 is a memory card that is attachable/detachableto/from the digital camera 100 via a card slot/detection SW 114,constituted by, for example, NAND type flash memory. The mainmicrocomputer 118 manages data recorded in the flash memory card 115 asa file according to a predetermined file system such as a FAT (FileAllocation Table) file system.

The memory card controller 113 controls the flash memory card 115 andrecords data from the DRAM 116 to the flash memory card 115. Also, thememory card controller 113 reads out data from the flash memory card 115and performs data transfer to the DRAM 116. The card slot/detection SW114 is a slot in which the flash memory card 115 is mounted, andincludes a detection SW (switch) for detecting whether or not the flashmemory card 115 is mounted in the slot.

Operation keys 117 are various kinds of switches that receive variousoperations from a user, and include a shutter button for performing anoperation of capturing still images, a trigger button for instructingthe start and stop of moving image capture, and a mode switch forswitching between a camera capturing mode and a reproduction mode.

The ROM 119 is a non-volatile memory that is capable of electricallydeleting/recording, and that stores constants, programs, and the likefor operation of the main microcomputer 118. The program mentioned hereis a program for executing various later-described sequences in thepresent embodiment, and realizes the later-described operations of thepresent embodiment.

The main microcomputer 118 has a CPU and operates according to theoperation programs stored in the ROM 119, and controls the units of thedigital camera 100. The main microcomputer 118 performs display controlby controlling the liquid crystal driver 112 and the like. Also, in thepresent embodiment, the main microcomputer 118 utilizes tuning patternsignals with the same pattern as that stored in the flash memory card115, and performs later-described judgement of whether or not a testpattern is successful, and an operation of determining the optimum latchtiming.

FIG. 2 is a block diagram showing the detail of the memory cardcontroller 113. The memory card controller 113 performstransmission/reception of signals and data during writing and reading ofdata to and from the flash memory card 115 via a CLK line, a CMD line,and a DAT line. Specifically, a clock source 201 outputs clock signals(CLK signals) that are constituted by clock pulses and are used tocontrol the timing of reading/writing to the flash memory card 115 viathe CLK line.

The host controller 202 performs outputting of command signals relatedto reading/writing, and reception of response signals in response to thecommands from the flash memory card 115, via the CMD line. Also, thehost controller 202 performs control of transmitting/receiving data tobe written to the flash memory card 115 or data read out from the flashmemory card 115, via the DAT line. The host controller 202 transmitsmoving image data and still image data read from the buffer memory spacein the DRAM 116, or other data, to the flash memory card 115 via the DATline, in synchronization with clock signals from the clock source 201.

In reading and writing of data, as described above, the timing of thetransmission/reception of the clock pulse is different from that ofdata. For this reason, a delay element 203 delays the phase of the clocksignal according to control by the main microcomputer 118 when readingout data from the flash memory card 115, for example, and generatestiming signals for latching data output from the flash memory card 115.Then, a flip-flop 204 latches data output from the flash memory card 115according to the timing signals output from the delay element 203. Thatis to say, the timing signals define the timing of receiving data. Also,a flip-flop 206 latches data for writing from the host controller 202according to the timing from the clock source 201. Note that switchingbetween the CMD line and the DAT line according to input/output ofcommands and transmission/reception of data is performed by a signalbranch unit 205. Responses and data from the flash memory card 115 thatare output from the flip-flop 204 are sent to the host controller 202.

Next, a tuning operation of the present embodiment will be describedwith reference to FIGS. 1 and 2. The memory card controller 113 issues atest data transmission command to the flash memory card 115. In responseto this, the flash memory card 115 transmits a data string (test data)of 64 bytes in a predetermined pattern in synchronization with a clocksignal transmitted from the clock source 201. The memory card controller113 receives the test data according to the timing signal that isobtained by delaying the clock signal generated from the clock source201 by the delay element 203. Here, the phase of the timing signal canbe changed by changing the value of the number of delay stages that isset in the delay element 203. The main microcomputer 118 judges whetheror not the test data is successfully received, while changing the phaserelationship between the clock signal and the timing signal, or in otherwords, while changing the latch timing of the flip-flop 204.

Specifically, the main microcomputer 118 transmits a command to transmitthe test data to the flash memory card 115 in a state where the delayamount of the delay element 203 is set to a first delay amount. Then,the main microcomputer 118 uses the flip-flop 204 to receive the testdata transmitted from the flash memory card 115 according to a timingsignal with the first delay amount. The main microcomputer 118 comparesthe received test data to test data that is held in advance, and judgeswhether or not the test data was correctly received.

Upon completion of the reception processing of the test data accordingto the timing signal with the first delay amount, next, the mainmicrocomputer 118 sets the delay amount of the delay element 203 to asecond delay amount and causes the flash memory card 115 to send thecommand to transmit the test data again. Then, the main microcomputer118 determines whether or not the test data received according to thetiming signal with the second delay amount is correctly received.

In this way, the main microcomputer 118 repeats processing fordetermining whether or not the test data is correctly received at eachdelay amount, while changing the delay amount of the delay element 203.Note that the delay amount to be changed in one instance is about oneseveral tenths of one cycle of a clock signal. Then, upon completion ofthe reception of the test data according to the timing signals with allthe delay amounts, the main microcomputer 118 selects the delay amountwith which the reception of the test data has succeeded the most stably,and sets this delay amount in the delay element 203 as the delay amountof the timing signal.

The series of processing described above is referred to as latch timingtuning processing (that is, processing for adjusting the delay amount ofthe timing signal). In this way, while tuning processing is performed,writing and reading of the image data to/from the flash memory card 115cannot be performed.

Next, with reference to FIG. 3, processing will be described in whichthe digital camera 100 controls execution of tuning duringpre-recording. Unless otherwise stated, processing in the steps in thisflowchart is performed by the main microcomputer 118 executing operationprograms stored in the ROM 119 to control the units of the digitalcamera 100.

Particularly, with reference to FIG. 3, an example of a moving imagecapturing mode for recording MPEG moving image data encoded using anMPEG encoding method accompanying inter-frame predictive encoding willbe described. However, the present embodiment is not limited tointer-frame predictive encoding and MPEG encoding method, and can beapplied to a case of recording any kind of moving image data isrecorded. Furthermore, the data to be recorded is not limited to movingimage data, and the present embodiment can be applied to a case whereany data is continuously input to the buffer memory.

In addition to a normal recording mode, the digital camera 100 has apre-recording mode in which pre-recording is activated. In the normalrecording mode, when a recording start instruction is given by the user,the digital camera 100 starts encoding and recording of the moving imagefrom the frame corresponding to the recording start instruction. Then,when a recording stop instruction is given, the digital camera 100 stopsthe recording of the moving image.

On the other hand, when pre-recording is activated, the digital camera100 encodes a predetermined period's worth of moving image data, andrecords the encoded moving image data repeatedly to the buffer memoryspace in the DRAM 116 in the recording standby state. In the presentembodiment, for example, the digital camera 100 encodes four second'sworth of the moving image data in the recording standby state, andrecords the data sequentially in the buffer memory. Then, when the foursecond's worth of moving image data was recorded in the buffer memory,the digital camera 100 repeats processing for discarding the oldestpart, in terms of time, of the moving image data, and recording newmoving image data. When the recording start instruction is given by theuser, the digital camera 100 reads out a predetermined period's worth(e.g., four second's worth) of the moving image data stored in thebuffer memory before starting the recording, and records the data in theflash memory card 115. After that, the digital camera 100 continuouslyrecords the moving image data acquired after the recording startinstruction to the flash memory card 115.

During recording, the main microcomputer 118 also needs to receiveresponses to write commands that have been output to the flash memorycard 115, from the flash memory card 115. For this reason, even duringrecording, it is preferable that the memory card controller 113 receivesthe data transmitted from the flash memory card 115 at the proper latchtiming. On the other hand, since images generated through moving imagecapturing are generally large in data size, if data writing is preventedby the tuning processing, the available capacity inside the buffermemory decreases, which may lead to stopping of recording due to bufferoverflow. Since the available capacity in the buffer memory is smalljust after the start of recording, when tuning processing is performedjust after the start of recording, the likelihood of buffer overflowwill further increase. Accordingly, as will be described in detaillater, the main microcomputer 118 reduces the likelihood that tuningprocessing will be needed just after the start of recording by executingthe tuning processing at a predetermined timing during pre-recording.

In the recording standby state, when the user operates an operation key117 to activate pre-recording (input start instruction for startingcontrol of input to the buffer memory), the processing in the flowchartin FIG. 3 starts. In step S301, the main microcomputer 118 controls theMPEG encoding unit 109 so as to encode the moving image data, andaccumulates (inputs) the encoded moving image data in the buffer memoryin the DRAM 116 (moving image data buffer) allocated for moving imagedata.

In step S302, the main microcomputer 118 determines whether or not themoving image data accumulated in the moving image data buffer in theDRAM 116 has become aligned in units of GOPs. If the moving image datahas become aligned in units of GOPs, the processing advances to stepS303, and if not, the processing advances to step S306.

In step S303, the main microcomputer 118 discards the moving image datain the GOP that is the oldest in terms of time among the moving imagedata accumulated in the moving image data buffer in the DRAM 116. Notethat the objective of partly discarding the moving image data in unitsof GOPs is to prevent the data amount held in the moving image databuffer from exceeding the threshold. Accordingly, the discarding here isnot performed until the data amount held in the moving image data bufferreaches a predetermined amount (e.g., 90% of the buffer size).

In step S304, the main microcomputer 118 determines whether or not thetiming for performing the tuning processing has come. In the presentembodiment, the main microcomputer 118 executes tuning processingperiodically during pre-recording (in the recording standby state). Forexample, the main microcomputer 118 executes tuning processing everypredetermined period after pre-recording starts. If the timing fortuning processing has come, the processing advances to step S305, and ifnot, the processing advances to step S306.

In step S305, the main microcomputer 118 controls the memory cardcontroller 113 so as to perform tuning processing of the flash memorycard 115. In this way, the main microcomputer 118 performs tuningprocessing at a timing at which the moving image data buffer iscomparatively available (a timing at which the moving image data hasbeen partly discarded) during pre-recording (in the recording standbystate).

Note that the frequency and timing of the tuning processing are notlimited to the example shown in FIG. 3. The main microcomputer 118 needonly perform tuning processing at least once at a predetermined timingduring pre-recording. In addition, the units in which the mainmicrocomputer 118 discards the moving image data is not limited to unitsof GOPs. For example, the main microcomputer 118 may discard the movingimage data in units of frames or in units of seconds, and may discardthe moving image data in other units.

In step S306, the main microcomputer 118 determines whether or not tostart the recording of the moving image. For example, the mainmicrocomputer 118 determines that moving image recording is to bestarted when the user operates the operation key 117 to give therecording start instruction. If moving image recording is not started,the processing advances to step S307. If moving image recording isstarted, the processing in this flowchart ends. In this case, the mainmicrocomputer 118 controls the memory card controller 113 to read outthe moving image data stored in the moving image data buffersequentially starting from the oldest data in terms of time, and torecord the read-out data to the flash memory card 115.

In step S307, the main microcomputer 118 determines whether or not tostop the pre-recording. For example, when the user operates theoperation key 117 to give a pre-recording stop instruction, the mainmicrocomputer 118 determines that the pre-recording is to be stopped. Ifpre-recording is not stopped, the proceeding returns to step S301, andif the pre-recording is stopped, the processing in this flowchart ends.

FIG. 4 is a diagram showing a series of operations in the flowchart inFIG. 3 in chronological order, using transitions in the accumulationstate in the moving image data buffer in the recording standby state andthe recording state, and the period for write processing and tuningprocessing. In FIG. 4, the vertical axis indicates the amount of movingimage data accumulated in the moving image data buffer, and thehorizontal axis indicates time “t”. Note that the moving image databuffer is allocated to the DRAM 116.

In the present embodiment, the data writing speed to the flash memorycard 115 is higher than the data rate of the encoded moving image data.Thus, when recording moving image data, the main microcomputer 118temporarily stores the encoded moving image data in the buffer memoryspace in the DRAM 116. Then, when the data amount of the moving imagedata that is stored in the buffer memory and is yet to be recordedreaches a predetermined data amount, the main microcomputer 118 readsout the moving image data from the buffer memory and stores it in theflash memory card 115. Since the recording speed of the flash memorycard 115 is higher than the data rate of the moving image data, the dataamount of the moving image data stored in the buffer memory decreaseswhile the moving image data is being written to the flash memory card115. Then, when writing of the moving image data of a predetermined sizeto the flash memory card 115 is completed, the writing is stopped. Inthis way, in the present embodiment, in the period from when therecording of the moving image starts to when it stops, the recordingcontrol is performed such that the moving image data is intermittently(repeatedly) recorded in the flash memory card 115. Also, whenpre-recording is activated, the main microcomputer 118 performs writingprocessing to the flash memory card 115 continuously after the start ofrecording until the moving image data stored in the moving image databuffer reaches a size that is less than or equal to the size of oneinstance of writing.

In FIG. 4, the reference sign 401 indicates a period of the recordingstandby state. The reference sign 402 indicates timing of startingrecording. The reference sign 403 indicates a period of the recordingstate. The main microcomputer 118 acquires the moving image data andaccumulates the data in the moving image data buffer at the timingsindicated by reference signs 411, 412, and 413, respectively.

The main microcomputer 118 acquires the moving image data andaccumulates the data in the moving image data buffer at the timingindicated by reference sign 414. Also, at this timing, the mainmicrocomputer 118 determines that the moving image data has becomealigned in units of GOPs, and discards the moving image data of theoldest GOP at this time. Furthermore, the main microcomputer 118determines that the timing for tuning processing has come, and performstuning processing.

A period between the timing indicated by reference sign 414 and thetiming indicated by reference sign 415 is a tuning interval (a periodthat is not a timing for tuning processing). Accordingly, in thisperiod, the main microcomputer 118 performs the discarding of the movingimage data periodically, but does not perform tuning processing.

The main microcomputer 118 acquires the moving image data at the timingindicated by the reference sign 416 and accumulates the data in themoving image data buffer. Also, at this timing, the main microcomputer118 determines that the moving image data has become aligned in units ofGOPs, and discards the moving image data of the oldest GOP at this time.Furthermore, at this timing, since the timing 415 has passed at which apredetermined amount of time has elapsed since the timing 414 of theprevious tuning processing, the main microcomputer 118 determines thatthe timing for tuning processing has come. Accordingly, the mainmicrocomputer 118 performs tuning processing.

When pre-recording is activated, in the recording standby state, themain microcomputer 118 accumulates the moving image data with a dataamount that is close to the upper limit of the capacity of the movingimage data buffer in order to use the capacity of the moving image databuffer efficiently. Therefore, if a writing error or the like occursjust after the start of recording due to lack of tuning and the movingimage data no longer can be written, the moving image data bufferoverflows. In view of this, when pre-recording is activated, the mainmicrocomputer 118 performs tuning processing at the timings indicated byreference signs 414 and 416 in the recording standby state. Since thedata is not written to the flash memory card 115 in the recordingstandby state, the writing of the moving image data to the flash memorycard 115 will not be hindered even if tuning processing is performed.Also, at the timings indicated by the reference signs 414 and 416, dueto the moving image data being partly discarded, there is comparativelymore leeway in the available capacity of the moving image data buffer.Accordingly, even when the recording start instruction is given justafter executing tuning processing, it is possible to suppress anincrease in the likelihood that buffer overflow will occur.

As described above, according to the first embodiment, the digitalcamera 100 executes tuning processing at the predetermined timing duringexecution of pre-recording (e.g., the timing at which the partialdiscarding of moving image data is executed). In this way, thelikelihood that a writing error and the like will occur in the periodjust after the start of recording when the available capacity of thebuffer memory is small is reduced, and thus the likelihood that bufferoverflow will occur after the start of recording is reduced.

Second Embodiment

In the first embodiment, tuning processing during pre-recording wasdescribed. In a second embodiment, tuning processing performed after thestart of recording will be described. In the present embodiment, thebasic configuration of the digital camera 100 and the memory cardcontroller 113 is similar to that of the first embodiment (see FIGS. 1and 2). Hereinafter, the difference from the first embodiment willmainly be described.

Just after the start of recording, the available capacity of the movingimage data buffer is still small until the moving image data has beenrepeatedly written to the flash memory card 115. In view of this, in thesecond embodiment, the digital camera 100 performs tuning processing,avoiding a period just after the recording standby state transitions tothe recording state, in which the usage rate of the moving image databuffer is high.

With reference to FIG. 5, processing will be described in which thedigital camera 100 controls execution of tuning while the moving imagedata is recorded. Unless otherwise stated, processing in the steps inthis flowchart is performed by the main microcomputer 118 executingoperation programs stored in the ROM 119 to control the units of thedigital camera 100. In step S306 in FIG. 3, if the main microcomputer118 determines that recording the moving image is to be started, theprocessing in the flowchart in FIG. 5 starts.

In step S501, continuing from the recording standby state, the mainmicrocomputer 118 controls the MPEG encoding unit 109 so as to encodethe moving image data and accumulates the encoded moving image data in amoving image data buffer in the DRAM 116 allocated for moving imagedata.

In step S502, the main microcomputer 118 determines whether or not thetotal size of the moving image data accumulated in the moving image databuffer in the DRAM 116 has reached a write size. Here, the write size isthe size of moving image data to be written to the flash memory card 115in response to one write command. If the total size of the moving imagedata accumulated in the moving image data buffer has reached the writesize, the processing advances to step S503, and if not, the processingadvances to step S504.

In step S503, the main microcomputer 118 controls the memory cardcontroller 113 to issue a write command to the flash memory card 115.Then, the main microcomputer 118 writes, to the flash memory card 115,the moving image data accumulated in the moving image data buffer in theDRAM 116. As described above, just after a transition is made from therecording standby state to the recording state, moving image data with adata amount close to the upper limit of the capacity is accumulated inthe moving image data buffer. For this reason, until multiple instancesof writing have been executed and the total size of the moving imagedata accumulated in the moving image data buffer becomes less than thewrite size, it is determined that the size of the moving image dataaccumulated in the moving image data buffer has reached the write size,and writing is performed continuously.

In step S504, the main microcomputer 118 determines whether or not thetiming of performing tuning processing has come. In this embodiment,after the start of recording, continuing from the timing of the previoustuning in the recording standby state, the timing of tuning processingarrives every time a predetermined period has elapses. If the timing fortuning processing has come, the processing advances to step S505, and ifnot, the processing advances to step S507.

In step S505, the main microcomputer 118 determines whether or not theusage amount of the moving image data buffer, that is, the data amountof the moving image data that is yet to be recorded and is accumulatedin the moving image data buffer, is greater than or equal to thethreshold α (MB). If the usage amount of the moving image data buffer isnot greater than or equal to the threshold, the processing advances tostep S506, and if the usage amount is more than or equal to thethreshold, the processing advances to step S507.

In step S506, the main microcomputer 118 controls the memory cardcontroller 113 to perform tuning processing.

In step S507, the main microcomputer 118 determines whether or not tostop the recording of the moving image. For example, if the datacapacity in the flash memory card 115 becomes full, or if an instructionto stop the recording is given via the operation key 117, it isdetermined that the recording of the moving image is to be stopped. Ifthe recording of the moving image is not stopped, the processing returnsto step S501, and the main microcomputer 118 continues the recording ofthe moving image. If the recording of the moving image is stopped, theprocessing advances to step S508.

In step S508, in order to close the file, the main microcomputer 118writes, to the flash memory card 115, the moving image data and themanaging information that have been accumulated in the moving image databuffer in the DRAM 116.

FIG. 6 is a diagram showing a series of operations in the flowchart inFIG. 5 in chronological order, using the transitions of the accumulationstate in the moving image data buffer during the recording of the movingimage, and the time for write processing and tuning processing. In FIG.6, the vertical axis indicates the amount of moving image dataaccumulated in the moving image data buffer, and the horizontal axisindicates time “t”. Note that the moving image data buffer is allocatedto the DRAM 116. In addition, in FIG. 6, the reference signs that arethe same as those in FIG. 4 indicate the same or similar periods,timings, and the like of FIG. 4.

The processing in the recording standby state is similar to that in thefirst embodiment. At the timing 402 when the recording start instructionis given, since the moving image data stored in the moving image databuffer has reached the write size, the main microcomputer 118 controlsthe memory card controller 113 to start recording from the oldest movingimage data.

At the timings indicated by reference signs 611 and 612, the mainmicrocomputer 118 determines that the timing for tuning processing hascome. However, since the usage amount of the moving image data buffer ismore than or equal to the threshold α at these timings, the mainmicrocomputer 118 does not perform tuning processing. Thereafter, at thetiming indicated by reference sign 613, the usage amount of the movingimage data buffer becomes less than the threshold a. Therefore, the mainmicrocomputer 118 performs control for starting tuning processing, andtuning processing starts at the timing indicated by reference sign 614.

As described above, according to the second embodiment, the digitalcamera 100 does not perform tuning processing if the data amount held inthe buffer memory that is yet to be recorded is greater than or equal tothe threshold during recording the moving image data to the flash memorycard 115. Therefore, the digital camera 100 performs tuning processing,avoiding the period just after a transition is made from thepre-recording state to the recording state, in which the usage rate ofthe buffer memory is high. In this way, the likelihood that bufferoverflow will occur during recording the moving image data is reduced.

Other Embodiments

Embodiment(s) of the present invention can also be realized by acomputer of a system or apparatus that reads out and executes computerexecutable instructions (e.g., one or more programs) recorded on astorage medium (which may also be referred to more fully as a‘non-transitory computer-readable storage medium’) to perform thefunctions of one or more of the above-described embodiment(s) and/orthat includes one or more circuits (e.g., application specificintegrated circuit (ASIC)) for performing the functions of one or moreof the above-described embodiment(s), and by a method performed by thecomputer of the system or apparatus by, for example, reading out andexecuting the computer executable instructions from the storage mediumto perform the functions of one or more of the above-describedembodiment(s) and/or controlling the one or more circuits to perform thefunctions of one or more of the above-described embodiment(s). Thecomputer may comprise one or more processors (e.g., central processingunit (CPU), micro processing unit (MPU)) and may include a network ofseparate computers or separate processors to read out and execute thecomputer executable instructions. The computer executable instructionsmay be provided to the computer, for example, from a network or thestorage medium. The storage medium may include, for example, one or moreof a hard disk, a random-access memory (RAM), a read only memory (ROM),a storage of distributed computing systems, an optical disk (such as acompact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™),a flash memory device, a memory card, and the like.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2017-059692, filed Mar. 24, 2017, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. A recording apparatus comprising: an output unitconfigured to output a clock signal to a storage medium; an input/outputunit configured to output a write command and data to be written to thestorage medium according to the clock signal in order to write data tothe storage medium, and configured to receive data from the storagemedium according to a timing signal; a generation unit configured togenerate the timing signal by delaying the clock signal; an adjustmentunit configured to execute adjustment processing for adjusting a delayamount of the timing signal; a buffer memory configured to hold inputdata; an input control unit configured to execute input control to inputcontinuously recording target data to be recorded to the storage medium,to the buffer memory; a recording control unit configured to executerecording control for recording the recording target data held in thebuffer memory to the storage medium, using the input/output unit; and acontrol unit configured to control the input control unit, the recordingcontrol unit, and the adjustment unit, wherein the control unit:performs control such that the input control is started before arecording start instruction and the recording control is started inresponse to the recording start instruction; and performs control suchthat the adjustment processing is executed during execution of the inputcontrol and before the recording control is started in response to therecording start instruction.
 2. The recording apparatus according toclaim 1, comprising a discarding unit configured to partly discard therecording target data held in the buffer memory such that a data amountof the recording target data held in the buffer memory does not exceed afirst threshold while the input control is being executed before therecording start instruction is received.
 3. The recording apparatusaccording to claim 2, wherein the control unit performs control suchthat the adjustment processing is executed at a timing when therecording target data is partly discarded by the discarding unit.
 4. Therecording apparatus according to claim 2, wherein the discarding unitperforms discarding in units of GOPs, units of frames, or units ofseconds.
 5. The recording apparatus according to claim 1, wherein thecontrol unit performs control such that the adjustment processing isexecuted periodically during execution of the input control and beforethe recording control is started in response to the recording startinstruction.
 6. The recording apparatus according to claim 1, whereinthe control unit performs control such that both the input control andthe recording control are performed after the recording startinstruction is received.
 7. The recording apparatus according to claim1, wherein the control unit performs control such that the recordingcontrol is executed after the recording start instruction is receivedand until a recording stop instruction is received.
 8. The recordingapparatus according to claim 1, comprising a discarding unit configuredto discard the recording target data recorded in the storage medium fromthe buffer memory after the recording start instruction is received,wherein the control unit performs control such that the adjustmentprocessing is not executed if a data amount of the recording target dataheld in the buffer memory is greater than or equal to a second thresholdafter the recording start instruction is received.
 9. The recordingapparatus according to claim 1, comprising a receiving unit configuredto receive the recording start instruction from a user.
 10. Therecording apparatus according to claim 1, further comprising an imagecapturing unit, wherein the input control unit continuously inputsmoving image data captured by the image capturing unit to the buffermemory, as the recording target data.
 11. A control method executed by arecording apparatus comprising: an output unit configured to output aclock signal to a storage medium; an input/output unit configured tooutput a write command and data to be written to the storage mediumaccording to the clock signal in order to write data to the storagemedium, and configured to receive data from the storage medium accordingto a timing signal; a generation unit configured to generate the timingsignal by delaying the clock signal; and a buffer memory configured tohold input data, the control method comprising: executing adjustmentprocessing for adjusting a delay amount of the timing signal; executinginput control to input continuously recording target data to be recordedto the storage medium, to the buffer memory; executing recording controlfor recording the recording target data held in the buffer memory to thestorage medium, using the input/output unit; performing control suchthat the input control is started before a recording start instructionand the recording control is started in response to the recording startinstruction; and performing control such that the adjustment processingis executed during execution of the input control and before therecording control is started in response to the recording startinstruction.
 12. A non-transitory computer-readable storage medium whichstores a program for causing a computer of a recording apparatus toexecute a control method, the recording apparatus comprising: an outputunit configured to output a clock signal to a storage medium; aninput/output unit configured to output a write command and data to bewritten to the storage medium according to the clock signal in order towrite data to the storage medium, and configured to receive data fromthe storage medium according to a timing signal; a generation unitconfigured to generate the timing signal by delaying the clock signal;and a buffer memory configured to hold input data, the control methodcomprising: executing adjustment processing for adjusting a delay amountof the timing signal; executing input control to input continuouslyrecording target data to be recorded to the storage medium, to thebuffer memory; executing recording control for recording the recordingtarget data held in the buffer memory to the storage medium, using theinput/output unit; performing control such that the input control isstarted before a recording start instruction and the recording controlis started in response to the recording start instruction; andperforming control such that the adjustment processing is executedduring execution of the input control and before the recording controlis started in response to the recording start instruction.